/**
 * @Author:Geln Yang
 * @Created:2008-8-3
 * $ Revision: 1.0 $
 * $ Author: Geln Yang $
 * $ Date: 2008-8-3 $
 */
package com.gooex.web.action.user;

import javax.servlet.http.Cookie;
import org.c4j.string.StringTools;
import org.c4j.system.web.Constants;
import org.c4j.system.web.cookie.CookieTools;

import com.gooex.web.action.BaseAnonymousAction;
import com.opensymphony.xwork2.ActionContext;

/**
 * @Author:Geln Yang
 * @Created:2008-8-3
 */
public class LogoutAction extends BaseAnonymousAction {

	public String execute() throws Exception {
		ActionContext.getContext().getSession().clear();

		Cookie[] cookies = CookieTools.getCookies();
		for (int i = 0; i < cookies.length; i++) {
			Cookie cookie = cookies[i];
			if (!Constants.COOKIE_LOGIN_NAME.equals(cookie.getName()) || StringTools.isBlankOrNull(cookie.getValue())) {
				CookieTools.clearCookie(cookie);
			}
		}
		return SUCCESS;
	}

}
